home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 22
/
Amiga Format AFCD22 (Jan 1998, Issue 106).iso
/
-seriously_amiga-
/
shareware
/
hardware
/
a500ide
/
software
/
atid600.h
< prev
next >
Wrap
Text File
|
1997-11-05
|
3KB
|
91 lines
#define TF_BASE 0xDA0000
#define WORD_WIDE unsigned short int
#define BYTE_WIDE unsigned char
#define REG_INC 4
#define CS0 0x0000
#define CS1 0x8000
#define Y 0
#define TF_DATA (*(volatile WORD_WIDE *)(TF_BASE+ 0x0 * REG_INC + CS0))
#define TF_DATA_8BIT (*(volatile BYTE_WIDE *)(Y+TF_BASE+ 0x0 * REG_INC + CS0))
#define TF_ERROR (*(volatile BYTE_WIDE *)(Y+TF_BASE+ 0x1 * REG_INC + CS0))
#define TF_FEATURES (*(volatile BYTE_WIDE *)(Y+TF_BASE+ 0x1 * REG_INC + CS0))
#define TF_SECTOR_COUNT (*(BYTE_WIDE *)(Y+TF_BASE+ 0x2 * REG_INC + CS0))
#define TF_SECTOR_NUMBER (*(BYTE_WIDE *)(Y+TF_BASE+ 0x3 * REG_INC + CS0))
#define TF_CYLINDER_LOW (*(BYTE_WIDE *)(Y+TF_BASE+ 0x4 * REG_INC + CS0))
#define TF_CYLINDER_HIGH (*(BYTE_WIDE *)(Y+TF_BASE+ 0x5 * REG_INC + CS0))
#define TF_DRIVE_HEAD (*(BYTE_WIDE *)(Y+TF_BASE+ 0x6 * REG_INC + CS0))
#define TF_STATUS (*(volatile BYTE_WIDE *)(Y+TF_BASE+ 0x7 * REG_INC + CS0))
#define TF_COMMAND (*(volatile BYTE_WIDE *)(Y+TF_BASE+ 0x7 * REG_INC + CS0))
#define TF_ALTERNATE_STATUS\
(*(volatile BYTE_WIDE *)(Y+TF_BASE+ 0x6 * REG_INC + CS1))
#define TF_DEVICE_CONTROL TF_ALTERNATE_STATUS
#define TF_DRIVE_ADDRESS\
(*(volatile BYTE_WIDE *)(TF_BASE+ 0x7 * REG_INC + CS1))
/* Bit names for general use */
#define bit7 0x80
#define bit6 0x40
#define bit5 0x20
#define bit4 0x10
#define bit3 0x08
#define bit2 0x04
#define bit1 0x02
#define bit0 0x01
/* status register */
#define BSY bit7 /*Busy*/
#define DRDY bit6 /*drive ready*/
#define DWF bit5 /*drive write fault*/
#define DF DWF
#define DSC bit4 /*drive seek complete*/
#define SKC DSC
#define DRQ bit3 /*data request*/
#define CORR bit2 /*corrected data*/
#define IDX bit1 /*index*/
#define ERR bit0 /*error*/
/* device control register */
#define SRST bit2 /*software reset*/
#define nIEN bit1 /*interrupt enable*/
/* error register */
#define BBK bit7 /*bad block detected*/
#define UNC bit6 /*uncorrectable data error*/
#define MC bit5 /*media changed*/
#define IDNF bit4 /*ID Not Found*/
#define ABRT bit3 /*aborted command*/
#define MCR bit2 /*Media Change Requested*/
#define TK0NF bit1 /*Track 0 Not Found*/
#define AMNF bit0 /*Address Mark Not Found*/
/* drive / head register */
#define L bit6 /*L=0.CHS , L=1.LBA*/
#define DRV bit4 /*drive select 0=drive0*/
#define DRV0 0
#define DRV1 DRV
#define HS3 bit3 /* Head select / LBA bits 24-27*/
#define HS2 bit2 /**/
#define HS1 bit1
#define HS0 bit0
/* commands */
#define ATA_IDENTIFY_DRIVE 0xEC
#define ATA_EXECUTE_DRIVE_DIAGNOSTIC 0x90
#define ATA_SLEEP 0xE6
#define ATA_SEEK 0x70
#define ATA_READ_SECTORS 0x20
#define ATA_WRITE_SECTORS 0x30
#define ATA_NOP 0
#define ATA_IDLE 0xE3 /*0x97*/
#define ATA_IDLE_IMMEDIATE 0xE1 /*0x95*/
#define ATA_STANDBY_IMMEDIATE 0xE0
#define ATA_INIIIALIZE_DRIVE_PARAMETERS 0x91
#define ATA_SET_FEATURES 0xEF
#define ATA_CHECK_POWER_MODE 0xE5
/* features */
#define FEATURE_8BIT_ON 0x01
#define FEATURE_8BIT_OFF 0x81